package com.xb.cloud.order.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.xb.cloud.common.constant.DbConstants;
import com.xb.cloud.common.util.BeanUtils;
import com.xb.cloud.order.model.SoCancelReason;
import com.xb.cloud.order.model.SoCancelReasonExample;
import com.xb.cloud.order.model.mapper.SoCancelReasonMapper;
import com.xb.cloud.order.service.client.SoCancelReasonService;
import com.xb.cloud.order.service.client.bo.SoCancelReasonBo;
import com.xb.cloud.service.client.ServiceReturnInfo;
import com.xb.cloud.service.client.ServiceReturnUtils;

/**
 * 订单取消原因
 * 
 * @author kexue
 *
 */

@Service
public class SoCancelReasonServiceImpl extends AbstractService implements SoCancelReasonService {

	@Resource
	private SoCancelReasonMapper soCancelReasonMapper;

	@Override
	public ServiceReturnInfo getSoCancelReasonBoList(Long companyId) {
		SoCancelReasonExample soCancelReasonExample = new SoCancelReasonExample();
		soCancelReasonExample.createCriteria().andIsDeletedEqualTo(DbConstants.IS_DELETED_FALSE)
				.andIsEnabledEqualTo(DbConstants.TRUE)
				.andCompanyIdEqualTo(companyId);

		List<SoCancelReason> soCancelReasonList = soCancelReasonMapper.selectByExample(soCancelReasonExample);
		return ServiceReturnUtils
				.success(BeanUtils.newListAndCopyProperties(SoCancelReasonBo.class, soCancelReasonList));
	}

}
